import mock from 'mockjs';
import moment from 'moment';

const data = mock.mock({
    'array|5': [
        {
            'index|+1': 0,
            'data|10': [
                {
                    'id|+1': 0,
                    name() {
                        const ids = `${this.id}`.split('');
                        return `API${ids[ids.length - 1]}`;
                    },
                    'count|500-1000': 1,
                },
            ],
            date() {
                const now = moment();
                return +now.add(this.index, 'd');
            },
        },
    ],
});

export function getAPIUsedList(req, res) {
    res.json(data.array);
}
